package partlow.googleplaces.parsers;

import org.json.JSONException;
import org.json.JSONObject;

import partlow.googleplaces.datatypes.GooglePlacesCoordinate;

public class CoordinateParser extends GooglePlacesTypeParser<GooglePlacesCoordinate> {

	@Override
	public GooglePlacesCoordinate parse(JSONObject json) throws JSONException {
		GooglePlacesCoordinate obj = new GooglePlacesCoordinate();
		if(json.has("lat"))
        	obj.setLatitude(json.getDouble("lat"));
		if(json.has("lng"))
        	obj.setLongitude(json.getDouble("lng"));
		
		return obj;
	}

}
